/*
 * @Author: Islands 1430536748@qq.com
 * @Date: 2024-07-13 16:33:34
 * @LastEditors: 周洋 1430536748@qq.com
 * @LastEditTime: 2024-08-03 21:22:07
 * @version: 1.0.0
 * @Description: 路由
 */
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";

//1.路由列表数组
import { staticRoutes } from './modules/static';

//2.创建路由
export const router = createRouter({
    history: createWebHistory(),
    routes: staticRoutes as RouteRecordRaw[],
    //路由滚动行为--> 当屏幕出现滚动条时,to到别的页面，在返回，该方法自动记录滚动位置，并在返回时定位到该位置
    scrollBehavior: () => ({ left: 0, top: 0 }),
});
//3.导出使用
export default router
export function setupRouter(app: any) {    
    app.use(router)
}

//重置路由
export function resetRouter() {
    console.log("重置路由触发");
    
    router.replace({ path: "/dashboard" });
}
;